import config from "@/config"
import http from "@/utils/request"

export default {
	menu: {
		myMenus: {
			url: `${config.API_URL}platform/permission/list`,
			name: "获取我的菜单",
			get: async function(){
				return await http.get(this.url);
			}
		},
		roleAuth: {
			url: `${config.API_URL}platform/role/permission-tree`,
			name: "获取角色权限列表",
			get: async function(data){
				return await http.get(this.url, data);
			}
		},
		menuRoleMenu: {
			url: `${config.API_URL}platform/auth/profile`,
			name: "获取权限列表",
			get: async function(data){
				return await http.get(this.url, data);
			}
		},
		roleUpdateAuth: {
			url: `${config.API_URL}platform/role/update`,
			name: "修改角色权限",
			post: async function(data){
				return await http.put(this.url+'?role_id='+data.role_id, data, {
				});
			}
		},
		list: {
			url: `${config.API_URL}/system/menu/list`,
			name: "获取菜单",
			get: async function(){
				return await http.get(this.url);
			}
		}
	},
	dic: {
		tree: {
			url: `${config.API_URL}/system/dic/tree`,
			name: "获取字典树",
			get: async function(){
				return await http.get(this.url);
			}
		},
		list: {
			url: `${config.API_URL}/system/dic/list`,
			name: "字典明细",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		get: {
			url: `${config.API_URL}/system/dic/get`,
			name: "获取字典数据",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},
	configure: {
		list: {
			url: `${config.API_URL}config/index`,
			name: "配置信息列表",
			get: async function(params){
				let res = await http.get(this.url, params);
				let data = {data: {summary: '', total: res.data.length, data: res.data}, code: res.code, msg: res.msg}
				return data
			}
		},
		configUpdate: {
			url: `${config.API_URL}config/update`,
			name: "修改配置信息",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
	},
	role: {
		list: {
			url: `${config.API_URL}platform/role/list`,
			name: "获取角色列表",
			get: async function(params){
				let res = await http.get(this.url, params);
				await res.data.data.forEach(item => {
					item['status'] = JSON.stringify(item.status)
				})
				return res
			}
		}
	},
	user: {
		list: {
			url: `${config.API_URL}member/index`,
			name: "获取用户列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		memberResetPwd: {
			url: `${config.API_URL}member/resetPwd`,
			name: "管理员修改用户密码",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
		memberUpPwd: {
			url: `${config.API_URL}member/upPwd`,
			name: "用户修改密码",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
		memberUpdate: {
			url: `${config.API_URL}member/update`,
			name: "编辑用户信息（角色）",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
		memberGiveCard: {
			url: `${config.API_URL}member/giveCard`,
			name: "赠送会员",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
		memberSetStatus: {
			url: `${config.API_URL}member/setStatus`,
			name: "修改会员状态",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
		memberRealNameGetList: {
			url: `${config.API_URL}memberRealName/getList`,
			name: "获取实名记录列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		memberRealNameChangeStatus: {
			url: `${config.API_URL}memberRealName/changeStatus`,
			name: "审核实名",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
	},
	banner: {
		list: {
			url: `${config.API_URL}banner/index`,
			name: "banner图列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		create: {
			url: `${config.API_URL}banner/create`,
			name: "添加banner图",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
		update: {
			url: `${config.API_URL}banner/update`,
			name: "修改banner图",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
		delete: {
			url: `${config.API_URL}banner/delete`,
			name: "删除banner图",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
	},
	payment: {
		list: {
			url: `${config.API_URL}payment/index`,
			name: "支付通道列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		update: {
			url: `${config.API_URL}payment/update`,
			name: "修改支付通道信息",
			post: async function(data){
				return await http.post(this.url, data, {
				});
			}
		},
	},
	tenant: {
		list: {
			url: `${config.API_URL}platform/tenant/list`,
			name: "获取租户列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		create: {
			url: `${config.API_URL}platform/tenant/create`,
			name: "创建租户",
			post: async function(data){
				return await http.post(this.url, data);
			}
		},
		update: {
			url: `${config.API_URL}platform/tenant/update`,
			name: "更新租户",
			post: async function(data){
				return await http.post(this.url, data);
			}
		},
		delete: {
			url: `${config.API_URL}platform/tenant/delete`,
			name: "删除租户",
			post: async function(data){
				return await http.post(this.url, data);
			}
		},
		setStatus: {
			url: `${config.API_URL}platform/tenant/setStatus`,
			name: "设置租户状态",
			post: async function(data){
				return await http.post(this.url, data);
			}
		},
		audit: {
			url: `${config.API_URL}platform/tenant/audit`,
			name: "审核租户",
			post: async function(data){
				return await http.post(this.url, data);
			}
		},
		detail: {
			url: `${config.API_URL}platform/tenant/detail`,
			name: "获取租户详情",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		toggleStatus: {
			url: `${config.API_URL}platform/tenant/toggle-status`,
			name: "切换租户状态",
			post: async function(data){
				return await http.post(this.url, data);
			}
		}
	},
	auditVerification: {
		list: {
			url: `${config.API_URL}platform/audit-verification/list`,
			name: "获取实名列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		audit: {
			url: `${config.API_URL}platform/audit-verification/audit`,
			name: "实名审核",
			post: async function(data){
				return await http.post(this.url, data);
			}
		}
	},
}
